package com.dc.free.controller.charity;

import com.dc.free.controller.BaseController;
import com.dc.free.db.model.CUser;
import com.dc.free.db.service.CUserService;
import com.dc.free.interceptor.CharityInterceptor;
import com.dc.free.util.WebUtil;
import com.jfinal.aop.Clear;

@Clear(CharityInterceptor.class)
public class LoginController extends BaseController {

	public void index() {
		render("/view/charity/index.html");
	}
	
	public void captcha() {
		renderCaptcha();
	}
	
	public void validate() {
		//校验验证码
		if(!validateCaptcha("captcha")) {
			renderStatus(100000);
			return;
		}
		
		CUser user = CUserService.getUser(data.getString("actionId"), getPara("name"), getPara("no"));
		//校验用户
		if(user == null) {
			renderStatus(100001);
			return;
		}
		
		setUser(user);
		
		renderStatus(user);
	}
	
}
